{include file="public/meta" /} 

<title>编辑会员信息</title>
</head>
<body>
    <article class="cl pd-20">
        <form class="form form-horizontal" id="form-member-add">
            <input type="hidden" name="userid" id="userid" value="{$userInfo['id']}" />
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户名：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    {$userInfo['user_name']}
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户昵称：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="{$userInfo['user_nickname']}" placeholder="" id="nickname" name="nickname">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>性别：</label>
                <div class="formControls col-xs-8 col-sm-9 skin-minimal">
                    <div class="radio-box">
                        <input name="sex" type="radio" value="男" id="sex-1" {eq name="$userInfo['sex']" value="男"}checked{/eq}>
                        <label for="sex-1">男</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" id="sex-2" value="女" name="sex" {eq name="$userInfo['sex']" value="女"}checked{/eq}>
                        <label for="sex-2">女</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" id="sex-3" value="保密" name="sex" {eq name="$userInfo['sex']" value="保密"}checked{/eq}>
                        <label for="sex-3">保密</label>
                    </div>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>手机：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="{$userInfo['mobile']}" placeholder="" id="mobile" name="mobile">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>邮箱：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <input type="text" class="input-text" value="{$userInfo['email']}" placeholder="@" name="email" id="email">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">会员类型：</label>
                <div class="formControls col-xs-8 col-sm-9"> <span class="select-box">
                    <select class="select" size="1" name="type">
                        <option value="0" {if condition="$userInfo['type'] eq 0"}selected{/if}>粉丝</option>
                        <option value="1" {if condition="$userInfo['type'] eq 1"}selected{/if}>代言人</option>
                    </select>
                    </span>
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-4 col-sm-3">备注：</label>
                <div class="formControls col-xs-8 col-sm-9">
                    <textarea name="sign" id="sign" cols="" rows="" class="textarea"  placeholder="说点什么...最少输入10个字符" onKeyUp="textarealength(this,100)">{$userInfo['user_sign']}</textarea>
                    <p class="textarea-numberbar"><em class="textarea-length">0</em>/100</p>
                </div>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交保存&nbsp;&nbsp;">
                </div>
            </div>
        </form>
    </article>

<!--_footer 作为公共模版分离出去-->
{include file="public/footer" /} 
<!--/_footer /作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="__LIB__/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="__LIB__/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__LIB__/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__LIB__/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__LIB__/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$("#form-member-add").validate({
		rules:{
			username:{
				required:true,
				minlength:2,
				maxlength:16
			},
			sex:{
				required:true,
			},
			mobile:{
				required:true,
				isMobile:true,
			},
			// email:{
			// 	required:true,
			// 	email:true,
			// },
			// uploadfile:{
			// 	required:true,
			// },
			
		},
		onkeyup:false,
		focusCleanup:true,
		success:"valid",
		submitHandler:function(form){
			$.ajax({
                type: 'post', 
                url: '{:url('User/editsave')}', 
                data: {
                    'userid': $('#userid').val(),
                    'nickname': $('#nickname').val(),
                    'mobile':$('#mobile').val(),
                    'email':$('#email').val(),
                    'sex':$('input[name="sex"]:checked').val(),
                    'sign':$('#sign').val(),
                    'type':$("select[name=type]").val()
                },
                dataType:'json',
                success: function(data) { 
                    if(data.code==0)
                    {
                        parent.layer.msg(data.msg,{icon:1,time:1000});
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.window.location.reload();
                        parent.layer.close(index);
                    }
                    else
                    {
                        parent.layer.msg(data.msg,{icon:2,time:1000});
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    }
                    
                },
                error:function(data){
                    layer.msg('500：系统错误，请重试！',{icon:2,time:1000});
                }
            });
		}
	});
});
</script> 
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>